﻿@using ECG.Utility
@using ECG.WebUI.CustomHelpers
@model List<ECG.Common.ProductRateByCateTopListPagingDto>
@if (Model.Any())
{
    foreach (var item in Model)
    {
        var pDetailLink = Url.Action("Index", "ProductDetail", new { productId = item.Id, productName = StringUtil.RemoveSpecialCharactersVn(item.Name) });
        <li class="clearfix">
            <div class="interes-left fl">
                <a href="@pDetailLink">
                    <img src="@item.ImagePath.ImagePathThumb(65, 65)" width="65" height="65" alt="@item.Name" />
                </a>
            </div>
            <div class="interes-right fl">
                <h4>
                    <a href="@pDetailLink">@item.Name
                    </a>
                </h4>
                @if (item.PromotionPrice > 0)
                {
                    <p class="pItem-PriceOld">
                        @item.Price.ToString("##,###,###") đ
                    </p>
                    <p>
                        <span class="pItem-PriceNew interes-price">@item.PromotionPrice.ToString("##,###,###") đ</span>
                    </p>
                }
                else
                {
                    <p>
                        <span class="pItem-PriceNew interes-price">@item.Price.ToString("##,###,###") đ</span>
                    </p>
                }

                <div style="line-height: 13px; margin: 5px 0px;">
                    @{
                var starPercent = "0";
                if (item.AverageRate > 0)
                {
                    starPercent = (Convert.ToDouble(item.AverageRate) * 100 / 5).ToString("#.#").Replace(',', '.');
                }
                    }
                    <span class="itm-ratStars inlineBlocka"><span style="width: @starPercent%;" class="itm-ratStars itm-ratRating"></span></span>
                </div>
            </div>
        </li>
    }
@*        <li class="clearfix">
            <div class="interes-left fl">
                <a href="#">
                    <img src="" width="65" height="65" alt="" />
                </a>
            </div>
            <div class="interes-right fl">
                <h4>
                    <a href="#">Cho bé cảm giác như đang bú sữa mẹ
                    </a>
                </h4>
                <p>
                    <span class="pItem-PriceNew interes-price">15.000 đ</span>
                </p>
                <div style="line-height: 13px; margin: 5px 0px;">
                    <span class="itm-ratStars inlineBlocka"><span style="width: 60%;" class="itm-ratStars itm-ratRating"></span></span>
                </div>
            </div>
        </li>*@
}